import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { PageDashboardComponent } from './page-dashboard/page-dashboard.component';
import { PageErrorQuestionComponent } from './page-error-question/page-error-question.component';
import { PageExamComponent } from './page-exam/page-exam.component';
import { PageUserComponent } from './page-user/page-user.component';
import { PageLoginComponent } from './page-login/page-login.component';
import { PageRegisterComponent } from './page-register/page-register.component';
import { authUserGuard } from './auth-user.guard';

// 路由配置
const routes: Routes = [
  { path: 'login', component: PageLoginComponent },
  { path: 'reg', component: PageRegisterComponent },
  { path: 'dashboard', component: PageDashboardComponent, canActivate: [authUserGuard] },
  { path: 'error-question', component: PageErrorQuestionComponent, canActivate: [authUserGuard] },
  { path: 'exam', component: PageExamComponent, canActivate: [authUserGuard] },
  { path: 'user', component: PageUserComponent, canActivate: [authUserGuard] },
]

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class StarnightStudentRoutingModule { }
